<?php

/**
 * Created by PhpStorm.
 * User: lian
 * Date: 17/10/16
 * Time: 下午6:52
 */

require_once 'config.php';
class Util
{
    public static function systemErrorAlert($location) {
        //载入ucpass类
        require_once 'Ucpaas.class.php';
        //初始化必填
        $options['accountsid']= UCPAAS_ACCOUNT_SID;
        $options['token']= UCPAAS_TOKEN;
        //初始化 $options必填
        $ucpass = new Ucpaas($options);
        //开发者账号信息查询默认为json或xml
        $ucpass->getDevinfo('xml');

        $appId = UCPAAS_APP_ID;
        $to = "18612696710";
        $templateId = "232027";
        $param= $location;
        $status=$ucpass->templateSMS($appId,$to,$templateId,$param);
        $str1=get_object_vars(json_decode($status));
        $respCode=get_object_vars($str1['resp']);
        if($respCode['respCode']=="000000")
        {
            //短信发送成功
            $data = array('status'=>1,'message'=>'短信发送成功');
        }
        else
        {
            //短信发送失败
            $data = array('status'=>0,'message'=>'短信发送失败');
        }
    }

}